package com.zzl.admin.exception;

import com.zzl.admin.enums.ResultEnum;
import lombok.Getter;

/**
 * description: 系统自定义异常
 * @author 朱正磊
 * @date 2023-08-28 13:39:02
 */
@Getter
public class CommonException extends RuntimeException {

    private static final long serialVersionUID = -6645045840332393408L;

    private final Integer code;

    public CommonException(ResultEnum resultEnum) {
        super(resultEnum.getMessage());
        this.code = resultEnum.getCode();
    }

    public CommonException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public CommonException(String message) {
        super(message);
        this.code = 500;
    }

}
